public class MulType {

    public static void main(String[] args) {
        Worker worker = new Worker();
        System.out.println(worker.name);
        worker.hi();


        Person person = new Worker();
        System.out.println(person.name);// 静态绑定 拿的是person的name
        person.hi(); // 动态绑定 调用的是woker的方法
        /**
         * worker
         * i m woker
         * person
         * i m woker
         */
    }
}

class Person{
    public String name = "person";



    public void hi(){
        System.out.println("i m person");
    }
}

class  Worker extends Person{

    public String name = "worker";

    @Override
    public void hi() {
        System.out.println("i m woker");
    }
}
